namespace TXLooker.WorkItemExtention.WIQL
{
    using System;
    using System.Globalization;

    public class NodeValueList : NodeVariableList
    {
        public NodeValueList() : base(NodeType.ValueList)
        {
        }

        public override void Bind(IExternal e, NodeTableName tableContext, NodeFieldName fieldContext)
        {
            base.BindChildren(e, tableContext, fieldContext);
            if (e != null)
            {
                Tools.EnsureSyntax(base.GetChildrenDataType() != DataType.Unknown, SyntaxError.UnknownOrIncompatibleTypesInTheList, this);
            }
            base.Bind(e, tableContext, fieldContext);
        }

        public override bool CanCastTo(DataType type, CultureInfo culture)
        {
            return base.GetChildrenCanCastTo(type, culture);
        }

        public override Node Optimize(IExternal e, NodeTableName tableContext, NodeFieldName fieldContext)
        {
            base.OptimizeChildren(e, tableContext, fieldContext);
            return base.Optimize(e, tableContext, fieldContext);
        }

        public override Priority Priority
        {
            get
            {
                return Priority.CommaOperator;
            }
        }
    }
}

